#!/usr/bin/env bash

PREFIX=$(realpath $(cd "$(dirname "$0")"; pwd))

export NODE_ENV=production

if ! hash parcel 2>/dev/null; then
npx yarn global add parcel-bundler
fi


if [ ! -d "$PREFIX/dist" ]; then
git clone git@gitee.com:xvcbill/xvcbill.git dist
fi

cd $PREFIX/dist
rm -rf *.html *.css *.js *.map

cd $PREFIX
npx yarn run build

./qiniu.unload.coffee
#cd $PREFIX/dist
#git add .
#sync() {
#    git add -u && git commit -m '.' ;
#    local branch=`git branch 2> /dev/null | sed -e '/^[^*]/d' |awk -F' ' '{print $2}'`
#    git pull origin $branch && git push origin $branch;
#}
#sync
